package com.ruoyi.business.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.S7VariablesConfigMapper;
import com.ruoyi.business.domain.S7VariablesConfig;
import com.ruoyi.business.service.IS7VariablesConfigService;
import com.ruoyi.common.utils.CommentUtil;

/**
 * S7协议变量配置Service业务层处理
 * 
 * @author qiancheng
 * @date 2025-08-30
 */
@Service
public class S7VariablesConfigServiceImpl extends ServiceImpl<S7VariablesConfigMapper, S7VariablesConfig> implements IS7VariablesConfigService
{
    @Autowired
    private S7VariablesConfigMapper s7VariablesConfigMapper;

    /**
     * 查询S7协议变量配置
     * 
     * @param variableId S7协议变量配置主键
     * @return S7协议变量配置
     */
    @Override
    public S7VariablesConfig selectS7VariablesConfigByVariableId(Long variableId)
    {
        return s7VariablesConfigMapper.selectS7VariablesConfigByVariableId(variableId);
    }

    /**
     * 查询S7协议变量配置列表
     * 
     * @param s7VariablesConfig S7协议变量配置
     * @return S7协议变量配置
     */
    @Override
    public List<S7VariablesConfig> selectS7VariablesConfigList(S7VariablesConfig s7VariablesConfig)
    {
        return s7VariablesConfigMapper.selectS7VariablesConfigList(s7VariablesConfig);
    }

    /**
     * 新增S7协议变量配置
     * 
     * @param s7VariablesConfig S7协议变量配置
     * @return 结果
     */
    @Override
    public int insertS7VariablesConfig(S7VariablesConfig s7VariablesConfig)
    {
        s7VariablesConfig.setCreateTime(DateUtils.getNowDate());
        return s7VariablesConfigMapper.insert(s7VariablesConfig);
    }

    /**
     * 修改S7协议变量配置
     * 
     * @param s7VariablesConfig S7协议变量配置
     * @return 结果
     */
    @Override
    public int updateS7VariablesConfig(S7VariablesConfig s7VariablesConfig)
    {
        s7VariablesConfig.setUpdateTime(DateUtils.getNowDate());
        return s7VariablesConfigMapper.updateS7VariablesConfig(s7VariablesConfig);
    }

    /**
     * 批量删除S7协议变量配置
     * 
     * @param variableIds 需要删除的S7协议变量配置主键
     * @return 结果
     */
    @Override
    public int deleteS7VariablesConfigByVariableIds(Long[] variableIds)
    {
        return s7VariablesConfigMapper.deleteS7VariablesConfigByVariableIds(variableIds);
    }

    /**
     * 删除S7协议变量配置信息
     * 
     * @param variableId S7协议变量配置主键
     * @return 结果
     */
    @Override
    public int deleteS7VariablesConfigByVariableId(Long variableId)
    {
        return s7VariablesConfigMapper.deleteS7VariablesConfigByVariableId(variableId);
    }
}
